import request from "@/utils/request";
import qs from "qs";

export function getUserInfoListByTags(tagNameList: string[]) {
    return request({
        url: "/user/search/tags",
        method: "get",
        params: {
            tagNameList: tagNameList,
        },
        paramsSerializer: params => {
            return qs.stringify(params, {indices: false});
        }
    });
}

/**
 * 主页推荐列表
 */
export function getUserInfoList(pageSize: number, pageNum: number) {
    return request({
        url: "/user/recommend",
        method: "get",
        params: {
            pageSize: pageSize,
            pageNum: pageNum,
        }
    });
}

// 修改用户信息
export function updateUserInfo(user: any, loginUser: any) {
    return request({
        url: "/user/update",
        method: "post",
        data: {
            user,
        },
    });
}

/**
 * 用户登录接口
 * @param user
 */
export function userLogin(user: any) {
    return request({
        url: '/user/login',
        method: 'post',
        data: user
    })
}


/**
 * 用户当前信息接口
 */
export function userCurrent() {
    return request({
        url: '/user/current',
        method: 'get'
    })
}

export function getMatchUserList(num: number) {
    return request({
        url: '/user/match',
        method: "get",
        params: {
            num: num,
        }
    })
}
